import time
from concurrent.futures.thread import ThreadPoolExecutor


def task1():
    print("task1 start\n")
    time.sleep(1)
    print("task1 end\n")
    return "a"


def task2():
    print("task2 start\n")
    time.sleep(1)
    print("task2 end\n")
    return "b"


def task3():
    print("task3 start\n")
    time.sleep(1)
    print("task3 end\n")
    return "c"


start_time = time.time()
pool = ThreadPoolExecutor(max_workers=3)


f1 = pool.submit(task1)
f2 = pool.submit(task2)
f3 = pool.submit(task3)
pool.shutdown()

end_time = time.time()

print(f"一共耗时时间：{end_time - start_time:.2f}")
